package good.idea.data.excel.read;

import good.idea.data.excel.call.DataLoadChannel;
import good.idea.data.excel.context.ExcelBaseContext;
import good.idea.data.excel.context.ExcelTemplateContext;
import good.idea.data.excel.read.template.ExcelTemplateService;
import good.idea.data.excel.read.template.impl.ExcelTemplateServiceImpl;

import java.io.FileInputStream;
import java.io.InputStream;

/**
 * @author chm
 */
public class ExcelReadHelper {


    /**
     * 读取为模版
     *
     * @param context
     * @return
     */
    public static ExcelTemplateContext readForTemplate(ExcelBaseContext context) {
        InputStream templateInputStream = context.getTemplateInputStream();
        try {
            if (templateInputStream == null) {
                if (context.getTemplateFile() != null) {
                    templateInputStream = new FileInputStream(context.getTemplateFile());
                } else {

                }
            }
            ExcelTemplateService templateService = new ExcelTemplateServiceImpl();
            return templateService.readTemplate(templateInputStream);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {

        }
        return null;

    }

    public static void readForTemplate(InputStream inputStream, DataLoadChannel loadChannel) {
        ExcelTemplateService templateService = new ExcelTemplateServiceImpl();

    }


}
